package com.turbo.boot.crawler.spider.worker;

import com.alibaba.fastjson.JSONObject;
import com.xuxueli.crawler.rundata.RunData;
import org.apache.commons.lang3.StringUtils;

/**
 * 描述
 *
 * @author wuyn
 * @since 2024/4/17
 */
public abstract class BaseTurboApiCrawler<PageVo> extends BaseTurboCrawler<PageVo> {


    @Override
    public void crawl() {
        boolean buildResult = build();
        if (!buildResult) {
            return;
        }
        String result = remoteCall(xxlCrawlerBuilder.build().getRunData());

        if (StringUtils.isNotEmpty(result)) {
            this.parse(result);
        }
    }


    public abstract String remoteCall(RunData runData);

    public abstract void parse(String result);

    public void parse(JSONObject result){

    }
}
